package com.itheima.sh.feign.order.fallback;

import com.itheima.sh.entity.OrderEntity;
import com.itheima.sh.feign.order.OrderFeign;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

/**
 * @Description: 实现限流保护后返回的方法，异常、限流时触发执行
 * @Version: V1.0
 */
@Component
public class OrderFeignFallback implements OrderFeign {

    @Override
    public List<OrderEntity> findOrderInfoByUserId(Integer userId) {
        List<OrderEntity> list = new ArrayList<>();

        OrderEntity entity = new OrderEntity();
        entity.setGoodsName("被限流了");
        entity.setId(-1);

        list.add(entity);
        return list;
    }

    @Override
    public String findAll() {
        return "稍后重试。。。";
    }
}
